package lian;
class Animal
{
    String name="xiang";
    int age;
    /*public Animal(String name,int age)
    {
        this.name=name;
        this.age=age;


    }

     */
    public void eat()
    {
        System.out.println(name+"正在吃饭");
    }
    public void texing()
    {
        System.out.println("动物的特性是睡觉");
    }
    public void bark(String name)
    {
        System.out.println(name+"带参数正在狗叫");

    }



}
class Cat extends Animal
{
    String name="long";
    public void eat()
    {
        System.out.println(name+"正在吃饭");
    }

}
class Dog extends Animal {


    String name="wang";
    String silly="傻狗";

    /*public Dog(String name, int age, String silly) {
        super(name, age);
        this.silly = silly;

    }

     */
    public void bark()
    {
        System.out.println(name+"不带参数正在狗叫");
    }

    public void eat() {

        System.out.println(silly+name + "正在吃饭");
    }
}



public class test {
    public static void Animaeat(Animal e)
    {
        e.eat();

    }

    public static void main(String[] args) {
        Dog a=new Dog();
        a.bark("rong");

    }

    public static void main3(String[] args) {
        Dog b=new Dog();
        Animaeat(b);

    }

    public static void main2(String[] args) {
        Dog a = new Dog();
        Animal b = a;
        if (b instanceof Dog)

            a = (Dog) b;
        System.out.println(a.silly);
    }

    public static void main1(String[] args) {
        //Dog a=new Dog();
        //Cat b=new Cat();
        Animaeat(new Dog());
        Animaeat(new Cat());

    }




}
